import type { PiniaPlugin } from 'pinia'
import { cloneDeep } from 'lodash'

const DeepClone = (target) => {
  cloneDeep(target)
}
export const piniaReset: PiniaPlugin = ({ store }) => {
  const initialState = DeepClone(store.$state)
  store.$reset = () => {
    store.$patch(initialState)
  }
}
